/*
 * Created on Dec 5, 2003
 *
 * To change the template for this generated file go to
 * Window - Preferences - Java - Code Generation - Code and Comments
 */
package org.vectrics.skill.struts;


import org.apache.struts.action.ActionErrors;
import org.apache.struts.action.ActionMapping;
import org.apache.struts.action.ActionMessage;
import org.apache.struts.action.ActionMessages;
import org.vectrics.struts.Request;
import org.vectrics.struts.VectricsActionForm;

import java.util.Date;

public class UserEvaluationForm extends VectricsActionForm {

	private static final long serialVersionUID = 83824410276877151L;

	private String id = null;
	private String userId = null;
	private String evaluatorId = null;
	private Date dateCreated = new Date();
	private Date datePerformed = new Date();
	private String description = "No Description Entered";
	private String notes = "";
	private String userFullName = null;
	private String score = null;
	private String type = null;
	/**
	 * @return Returns the dateCrseated.
	 */
	public Date getDateCreated() {
		return dateCreated;
	}

	/**
	 * @param dateCreated The dateCreated to set.
	 */
	public void setDateCreated(Date dateCreated) {
		this.dateCreated = dateCreated;
	}

	/**
	 * @return Returns the datePerformed.
	 */
	public Date getDatePerformed() {
		return datePerformed;
	}

	/**
	 * @param datePerformed The datePerformed to set.
	 */
	public void setDatePerformed(Date datePerformed) {
		this.datePerformed = datePerformed;
	}

	/**
	 * @return Returns the description.
	 */
	public String getDescription() {
		return description;
	}

	/**
	 * @param description The description to set.
	 */
	public void setDescription(String description) {
		this.description = description;
	}

	/**
	 * @return Returns the evaluatorId.
	 */
	public String getEvaluatorId() {
		return evaluatorId;
	}

	/**
	 * @param evaluatorId The evaluatorId to set.
	 */
	public void setEvaluatorId(String evaluatorId) {
		this.evaluatorId = evaluatorId;
	}

	/**
	 * @return Returns the id.
	 */
	public String getId() {
		return id;
	}

	/**
	 * @param id The id to set.
	 */
	public void setId(String id) {
		this.id = id;
	}

	/**
	 * @return Returns the notes.
	 */
	public String getNotes() {
		return notes;
	}

	/**
	 * @param notes The notes to set.
	 */
	public void setNotes(String notes) {
		this.notes = notes;
	}

	/**
	 * @return Returns the userId.
	 */
	public String getUserId() {
		return userId;
	}

	/**
	 * @param userId The userId to set.
	 */
	public void setUserId(String userId) {
		this.userId = userId;
	}

	
	/**
	 * @return Returns the fullName.
	 */
	public String getUserFullName() {
		return userFullName;
	}

	/**
	 * @param fullName The fullName to set.
	 */
	public void setUserFullName(String userFullName) {
		this.userFullName = userFullName;
	}

	/**
	 * @return the score
	 */
	public String getScore() {
		return score;
	}

	/**
	 * @param score the score to set
	 */
	public void setScore(String score) {
		this.score = score;
	}

	/**
	 * @return the type
	 */
	public String getType() {
		return type;
	}

	/**
	 * @param type the type to set
	 */
	public void setType(String type) {
		this.type = type;
	}

	@Override
	protected ActionErrors doValidate(ActionMapping mapping, Request request) {
		if ((request.getParameter("cancel") != null)||(request.getParameter("cancel.x") != null)) {
			return super.doValidate(mapping, request);
		}
		
		ActionErrors errors= super.doValidate(mapping, request);
		if ((this.getDescription() == null)||(this.getDescription().trim().equals(""))){
			ActionMessage error = new ActionMessage("error.evaluation.descrition");
			errors.add(ActionMessages.GLOBAL_MESSAGE,error);
		}
		if ((this.getScore() == null)||(this.getScore().trim().equals(""))){
			ActionMessage error = new ActionMessage("error.evaluation.score");
			errors.add(ActionMessages.GLOBAL_MESSAGE,error);
		}		
		
		return errors;
	}
	
}
